<template>
  <div class="art-container">
     <div class="slider">
        <dl>
          <dl v-for="(item,index) in artList" :key="index" style="margin-left:10px">
            <dt style="font-weight:bold">
              {{item.name}}
            </dt>
            <dl v-for="subItem in item.children" :key="subItem.id" style="margin-left:20px">
              <dd @click="go(subItem.id)">{{subItem.name}}</dd>
            </dl>
          </dl>

        </dl>
     </div>
     <div class="main">
        <!-- 三级路由出口 -->
        <router-view></router-view>
     </div>
  </div>
</template>

<script>
export default {
  data(){
    return{
      artList:[
        {
          name:'华语',
          children:[
            {
              id:'1001',
              name:'华语男歌手',
              path:'/discovery/artist/cat/1001'
            },
            {
              id:'1002',
              name:'华语女歌手',
              path:'/discovery/artist/cat/1002'
            },
            {
              id:'1003',
              name:'华语组合乐队',
              path:'/discovery/artist/cat/1003'
            }
          ]
        },
        {
          name:'欧美', 
          children:[
            {
              id:'2001',
              name:'欧美男歌手',
              path:'/discovery/artist/cat/2001'
            },
            {
              id:'2002',
              name:'欧美女歌手',
              path:'/discovery/artist/cat/2002'
            },
            {
              id:'2003',
              name:'欧美组合乐队',
              path:'/discovery/artist/cat/2003'
            }
          ]
          
        },
        {
          name:'日本',
           children:[
            {
              id:'3001',
              name:'日本男歌手',
              path:'/discovery/artist/cat/3001'
            },
            {
              id:'3002',
              name:'日本女歌手',
              path:'/discovery/artist/cat/3002'
            },
            {
              id:'3003',
              name:'日本组合乐队',
              path:'/discovery/artist/cat/3003'
            }
          ]
        },
      ]
    }
  },
  methods:{
    go(id){
      this.$router.push({
        name:'CategoryArt',/*路由名称 */
        params:{
          cid:id
        }
      })
    }
  }
}
</script>

<style lang="scss">
  .art-container{
    display: flex;
    width: 100vw;
    height: 500px;
    .slider{
      width: 220px;
      height: 100%;
      background-color: #ccc;
    }
    .main{
      flex-grow: 1;
      height: 100%;
      background-color:yellow;
    }
  }
</style>